/**
 * Created by Intellij IDEA
 *
 * @author 王俊凯
 * @Date: 2023/3/16 17:31
 * @Version 1.0
 */
package com.eight.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eight.pojo.BaseArea;
import com.eight.service.BaseAreaService;
import com.eight.vo.ComResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/rent/baseArea")
public class BaseAreaController {

    @Autowired
    private BaseAreaService baseAreaService;

    @RequestMapping("/parent")
    public ComResult parent(String parentId){
        QueryWrapper<BaseArea> wrapper=new QueryWrapper();
        wrapper.eq("parentid",parentId);
        List<BaseArea> list = baseAreaService.list(wrapper);
        return new ComResult(2000,"查询成功",list);
    }

        @RequestMapping("/baseArea")
    public ComResult baseArea(String parentId){
        QueryWrapper<BaseArea> wrapper=new QueryWrapper<>();
        wrapper.eq("base_areaid",parentId);
        BaseArea areaServiceOne = baseAreaService.getOne(wrapper);
        return new ComResult(2000,"查询成功",areaServiceOne);
    }

}

